<%-- 
    Document   : newThread
    Created on : 20-nov-2008, 11:09:54
    Author     : org.@le

--%>

<%@taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@taglib uri="http://richfaces.org/rich" prefix="rich"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body onload="reloadAjaxPanels()">
        <f:view>
            <h:form>
                <a4j:jsFunction name="reloadAjaxPanels"
                                reRender="buttons" />
                <rich:panel header="Compose new thread" id="reply" style="border-color: white" >
                    <h:panelGrid columns="3">
                        <h:outputText value="Title: " />
                        <h:inputText  id="subject" value="#{ForumsSession.currentThread.subject}" requiredMessage="This field is required." required="true" maxlength="60"/>
                        <h:message for="subject" style="color: red" styleClass="errorMessage" />
                        <h:outputText value="Handle: " />
                        <h:selectOneMenu value="#{ForumsSession.nickId}">
                            <c:forEach items="#{sessionBean.ejbSession.owner.handles}" var="handle">
                                <f:selectItem itemValue="#{handle.id}" itemLabel="#{handle.name}" />
                            </c:forEach>
                        </h:selectOneMenu>
                        <h:outputText value="" />
                    </h:panelGrid>
                    <br />
                    <rich:panel id="buttons" style="border:0px" >
                        <rich:panel style="border:0px" rendered="#{!ForumsSession.created}">
                            <h:commandButton value="Save" action="#{ForumsSession.createTopic}" >
                                <a4j:support event="onclick" oncomplete="parent.frames['menu'].window.location.reload();" />
                            </h:commandButton>
                        </rich:panel>
                    </rich:panel>
                </rich:panel>
            </h:form>
        </f:view>
    </body>
</html>
